package com.jn.exam.webSocket.utils;

import com.alibaba.fastjson.JSONObject;
import com.jn.exam.webSocket.entity.MessageResult;

import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;

/**
 * @author 江南大学1033190417
 * @date 2022/3/4 19:19
 */
public class EncoderServer implements Encoder.Text<MessageResult> {
    @Override
    public String encode(MessageResult messageResult) throws EncodeException {
        return JSONObject.toJSONString(messageResult);
    }

    @Override
    public void init(EndpointConfig endpointConfig) {
        // TODO Auto-generated method stub
    }

    @Override
    public void destroy() {
        // TODO Auto-generated method stub
    }
}
